package day05;

import java.util.Random;
import java.util.Scanner;

//加法
public class Addition {
    public static void main(String[] args) {
        Random rand=new Random();
        Scanner scann=new Scanner(System.in);
        int score=0;
        System.out.println("开始答题，答对加10分，输入-1退出");
        for (int i=1;i<=10;i++){;
            int num1= rand.nextInt(100);
            int num2= rand.nextInt(100);
            System.out.println(num1+"+"+num2+"=?");
            int result=scann.nextInt();
            if (num1+num2==result){
                score+=10;
                System.out.println("答案正确");
            }else {
                System.out.println("答案错误");
            }
        }
        System.out.println("答题结束分数为"+score);
    }
}
